﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Data.Linq;

namespace Inbox.Domain
{
    [Table(Name = "dbo.Machine")]
    public class Machine : PersistentObject
    {
        #region **Private**

        private int? _MachineType, _DepreciationRate;
        private decimal? _PurchaseValue, _NetValue;
        private string _Name;
        private DateTime? _UsedDate, _EndUseDate;

        #endregion
        [Column(Name = "[Name]", Storage = "_Name", DbType = "NVarChar(50)", UpdateCheck = UpdateCheck.Never)]
        public string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this._Name = value;
            }
        }

        [Column(Storage = "_MachineType", DbType = "Int", UpdateCheck = UpdateCheck.Never)]
        public int? MachineType
        {
            get { return this._MachineType; }
            set { this._MachineType = value; }
        }

        [Column(Storage = "_PurchaseValue", DbType = "Decimal(18,0)", UpdateCheck = UpdateCheck.Never)]
        public decimal? PurchaseValue
        {
            get { return this._PurchaseValue; }
            set { this._PurchaseValue = value; }
        }

        [Column(Storage = "_NetValue", DbType = "Decimal(18,0)", UpdateCheck = UpdateCheck.Never)]
        public decimal? NetValue
        {
            get { return this._NetValue; }
            set { this._NetValue = value; }
        }

        [Column(Storage = "_UsedDate", DbType = "DateTime", UpdateCheck = UpdateCheck.Never)]
        public DateTime? UsedDate
        {
            get { return this._UsedDate; }
            set { this._UsedDate = value; }
        }

        [Column(Storage = "_EndUseDate", DbType = "DateTime", UpdateCheck = UpdateCheck.Never)]
        public DateTime? EndUseDate
        {
            get { return this._EndUseDate; }
            set { this._EndUseDate = value; }
        }

        [Column(Storage = "_DepreciationRate", DbType = "Int", UpdateCheck = UpdateCheck.Never)]
        public int? DepreciationRate
        {
            get { return this._DepreciationRate; }
            set { this._DepreciationRate = value; }
        }

        [Column(Name = "ID", Storage = "_ID", DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true, UpdateCheck = UpdateCheck.Never)]
        public override Guid ID
        {
            get
            {
                return base._ID;
            }
            set
            {
                base._ID = value;
            }
        }

        [Column(Storage = "_deleted", DbType = "Bit", UpdateCheck = UpdateCheck.Never)]
        public override bool Deleted
        {
            get
            {
                return base._deleted;
            }
            set
            {
                base._deleted = value;
            }
        }

        [Column(Storage = "_createUser", DbType = "NVarChar(50)", UpdateCheck = UpdateCheck.Never)]
        public override string CreateUser
        {
            get
            {
                return base._createUser;
            }
            set
            {
                base._createUser = value;
            }
        }

        [Column(Storage = "_createDate", DbType = "DateTime", UpdateCheck = UpdateCheck.Never)]
        public override DateTime CreateDate
        {
            get
            {
                return base._createDate;
            }
            set
            {
                base._createDate = value;
            }
        }

        [Column(Storage = "_timeStamp", AutoSync = AutoSync.Always, DbType = "rowversion", IsDbGenerated = true, IsVersion = true, UpdateCheck = UpdateCheck.Never)]
        public override System.Data.Linq.Binary TimeStamp
        {
            get
            {
                return base._timeStamp;
            }
        }

        //[Association(Name = "Machine_Machine_Equipment", Storage = "Machine_Equipment", ThisKey = "ID", OtherKey = "Machine_ID")]
        //public EntitySet<Machine_Equipment> Machine_Equipment
        //{
        //    get
        //    {
        //        return this.Machine_Equipment;
        //    }

        //    set
        //    {
        //        this.Machine_Equipment.Assign(value);
        //    }
        //}

        //[Association(Name = "Machine_Machine_Planning", Storage = "Machine_Planning", ThisKey = "ID", OtherKey = "Machine_ID")]
        //public EntitySet<Machine_Planning> Machine_Planning
        //{
        //    get
        //    {
        //        return this.Machine_Planning;
        //    }
        //    set
        //    {
        //        this.Machine_Planning.Assign(value);
        //    }
        //}

        public Machine()
        {
            //this.Machine_Equipment = new EntitySet<Machine_Equipment>();
            //this.Machine_Planning = new EntitySet<Machine_Planning>();

        }
    }
}

